using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Project
{
    public class BuffIcon : MonoBehaviour, IPointerExitHandler, IPointerMoveHandler, IPointerEnterHandler
    {
        private BuffID mBuffID;

        public void Init(BuffID buffID, Sprite sprite)
        {
            mBuffID = buffID;
            GetComponent<Image>().sprite = sprite;
        }
        void IPointerExitHandler.OnPointerExit(PointerEventData e)
        {
            EventCenter.GetInstance().EventTrigger("HideBuffIcon");
        }
        void IPointerMoveHandler.OnPointerMove(PointerEventData e)
        {
            EventCenter.GetInstance().EventTrigger("BuffIconMove", e.position);
        }
        void IPointerEnterHandler.OnPointerEnter(PointerEventData e)
        {
            EventCenter.GetInstance().EventTrigger("ShowBuffIcon", mBuffID);
        }
    }
}